Follow @prust_dev
Peter's Dev Blog
Jan. 10, 2013
JAVASCRIPT

'this' is automatically set, even for functions on object literals

Whenever you use dot notation to call a function that is a property of the object, this is set to that object -- even if it’s a simple object literal:

>>> var obj = {'a': function() {return this;}};
>>> obj.a()
Object { a=function()}